package com.itstyle.seckill.topic.redis.Iservice.serviceImpl;

import com.itstyle.seckill.topic.redis.Iservice.InventoryProductBiz;
import com.itstyle.seckill.topic.redis.Iservice.Request;
import com.itstyle.seckill.topic.redis.bean.InventoryProduct;
import org.springframework.transaction.annotation.Transactional;





/**
 * @Auther: liuwenxiang
 * @Date: 2020/2/23 17:51
 * @Description:
 */
public class InventoryUpdateDBRequest implements Request {


    private InventoryProductBiz inventoryProductBiz;
    private InventoryProduct inventoryProduct;

    public InventoryUpdateDBRequest(InventoryProduct inventoryProduct,InventoryProductBiz inventoryProductBiz){
        this.inventoryProduct = inventoryProduct;
        this.inventoryProductBiz = inventoryProductBiz;
    }
    @Override
    @Transactional
    public void process() {
        inventoryProductBiz.removeInventoryProductCache(inventoryProduct.getProductId());
        inventoryProductBiz.updateInventoryProduct(inventoryProduct);
    }
    @Override
    public Integer getProductId() {
        // TODO Auto-generated method stub
        return inventoryProduct.getProductId();
    }
    @Override
    public boolean isForceFefresh() {
        // TODO Auto-generated method stub
        return false;
    }


}
